<include file="Admin:header" />
<style>
#cart_box{  overflow:hidden;margin-top:15px;}
#buy_ico {float:left;width:90px;height:95px;margin:5px 35px;_margin:5px 25px;background:url(cart.jpg) no-repeat;}
#buy_tab {float:left;margin-top:40px;background:url(buy_tabs.gif) no-repeat;width:385px;height:35px;line-height:35px;}
#buy_tab ul {margin:0;padding:0;width:385px;height:35px;line-height:35px;background:url(buy_on.gif) no-repeat -20px 0;}
#buy_tab ul.buy_1 {background:url(buy_on.gif) no-repeat 106px 0;}
#buy_tab ul.buy_2 {background:url(buy_on.gif) no-repeat 231px 0;}
#buy_tab ul li {float:left;width:105px;margin:0;text-align:center;padding-right:20px;}
#buy_tab ul li.one {width:105px;}
.order_table{ width:100%;  margin:0 auto; overflow:hidden;}
.order_table table{ width:100%; margin:20px auto;border:1px solid #eee;}
.order_table table th { border-bottom:2px #E2E9EA solid;background:#EEF3F7;color:#333;height:35px;}
.order_table table td { border-bottom:1px #eee solid; border-left:1px #eee solid; background:#F8F8F8;}
.order_table table td .num {text-align:center;}
#prototal{ float:right; margin:25px 15px 10px 0; display:inline;line-height:40px;}
#prototal span{ float:left;line-height:40px;}
#prototal span#totalnum {color:#FF3300;}
#prototal span#totalprice {color:#FF3300;font-size:18px;font-weight:bold;}
#buy_button{float:right; height:35px; margin:20px 25px 0px 0;_margin:20px 15px 0 0; display:inline;}
#buy_button img{ border:none;margin-left:60px;}
.img_but { border:none;margin-left:60px;}
.order_userinfo {margin:0 15px;}
.order_userinfo h2 {background: #9FD2FF;height:35px;line-height:35px;border:none;}
.order_userinfo ul {padding:5px;}
.order_userinfo ul li {line-height:28px;clear:both;}
.order_userinfo ul li input {line-height:18px;height:18px;padding:2px 3px;width:190px;}
.order_userinfo ul li span {float:left;width:80px;}
.order_ok_message {color:both;padding:20px;text-align:center;font-size:14px;color:#FB0000;line-height:26px;}

</style>
		<div class="order_table">
					 <form id="myform" action="<if condition="$action_name=='add'">{:U($module_name.'/insert')}<else />{:U($module_name.'/update')}</if>" method="post">
					<table cellpadding=0 cellspacing=0 class="table_form" width="100%">
 
                          <tr align="center">
							<th colspan="4"  align="center"><span style="float:right;padding:5px;line-height:22px;">创建时间:{$cart['createtime']|toDate=###,'Y-m-d H:i:s'}</span> <span style="float:left;padding:5px;color:#FB0000;line-height:22px;">订单号:{$cart['sn']}</span><input type="hidden" id="id" name="id" value="{$cart.id}" />
							</th>
                          </tr>
					<tr>
<?php
if(strpos($orderfield,'vk')!==false){
?>
					<td width="100">{%status}</td>
					<td width="100"><select id="status" name="status">		 
					<option value="0" <if condition="$cart['status'] ==0">selected="selected"</if>>{%status_0}</option>
					<option value="1" <if condition="$cart['status'] ==1">selected="selected"</if>>{%status_1}</option>
					<option value="2" <if condition="$cart['status'] ==2">selected="selected"</if>>{%status_2}</option>
					<option value="3" <if condition="$cart['status'] ==3">selected="selected"</if>>{%status_3}</option>
					<option value="4" <if condition="$cart['status'] ==4">selected="selected"</if>>{%status_4}</option>
					<option value="5" <if condition="$cart['status'] ==5">selected="selected"</if>>{%status_5}</option>
					<option value="6" <if condition="$cart['status'] ==6">selected="selected"</if>>{%status_6}</option>
					<option value="7" <if condition="$cart['status'] ==7">selected="selected"</if>>{%status_7}</option>
					</select></td>	
<?php
}
if(strpos($orderfield,'vl')!==false){
?>
						<td width="100">跟踪码</td>
						<td><input type="text" name="trackcode" id="trackcode" value="{$cart.trackcode}" />&nbsp;<input onclick="sendemail()" type="button" value="发送" class="button" /><span id="emailstatus"></span></td>
<?php
}
?>
					</tr>
<?php
if(strpos($orderfield,'vm')!==false){
?>
					<tr>
						<td>备注</td>
						<td colspan="3"><textarea style="height:100px;width:500px;" name="note1" id="note1">{$cart.note1}</textarea></td>
					</tr>
<?php
}
if(strpos($orderfield,'vd')!==false){
?>
					<tr>
						<td>姓</td>
						<td><input type="text" name="lastname" id="lastname" value="{$cart.lastname}" /></td>
						<td>名</td>
						<td><input type="text" name="firstname" id="firstname" value="{$cart.firstname}" /></td>
					</tr>
<?php
}
?>
					<tr>
<?php
if(strpos($orderfield,'vn')!==false){
?>
						<td>客户邮箱</td>
						<td><input type="text" name="email" id="email" value="{$cart.email}" /></td>
<?php
}
if(strpos($orderfield,'vp')!==false){
?>
						<td>联系电话</td>
						<td><input type="text" name="night_phone_a" size=3 id="night_phone_a" value="{$cart.night_phone_a}" /> - 
						<input type="text" name="night_phone_b" size=5 id="night_phone_b" value="{$cart.night_phone_b}" /> - 
						<input type="text" name="night_phone_c" size=15 id="night_phone_c" value="{$cart.night_phone_c}" />
						</td>
<?php
}
?>
					</tr>
					<tr>
<?php
if(strpos($orderfield,'vo')!==false){
?>
						<td>邮政编码</td>
						<td><input type="text" name="zipcode" id="zipcode" value="{$cart.zipcode}" />
						<input type="text" name="zipcode2" id="zipcode2" value="{$cart.zipcode2}" /></td>
<?php
}
if(strpos($orderfield,'vq')!==false){
?>
						<td>收货人</td>
						<td><input type="text" name="consignee" id="consignee" value="{$cart.consignee}" /></td>
<?php
}
?>

					</tr>
<?php
if(strpos($orderfield,'vr')!==false){
?>
					<tr>
						<td>国家/ 地区</td>
						<td><input type="text" name="country1" id="country1" value="{$cart.country1}" /></td>
						<td>省/ 直辖市/ 自治区</td>
						<td><input type="text" name="state" id="state" value="{$cart.state}" /></td>
					</tr> 
					<tr>
						<td>市/ 县</td>
						<td><input type="text" name="city" id="city" value="{$cart.city}" /></td>
						<td>街道地址</td>
						<td>
<textarea name="address1" id="address1" style="width:300px;height:50px;">
{$cart.address1}
</textarea>
<textarea name="address2" id="address2" style="width:300px;height:50px;">
{$cart.address2}
</textarea>
						</td>
					</tr> 
<?php
}
?>
					<tr>
<?php
if(strpos($orderfield,'vs')!==false){
?>
						<td>发货方式</td>
						<td><input type="text" name="logistics" id="logistics" value="{$cart.logistics}" /></td>
<?php
}
if(strpos($orderfield,'vt')!==false){
?>
						<td>客户留言</td>
						<td>
<textarea name="note" id="note" style="width:520px;height:50px;">
{$cart.note}
</textarea>
						</td>
<?php
}
?>
					</tr>
<!--
					<tr>
						<td>paypal信息</td>
						<td colspan="3">{$cart.ipn}</td>
					</tr>
-->
					</table>
				<div class="btn">
					<INPUT TYPE="submit"  value="{:L('dosubmit')}" class="button" >
					<input TYPE="reset"  value="{:L('cancel')}" class="button">
					</div>

{__TOKEN__}
				  </form>

					<br>
			</div>
		<br>
</div>
 <script>
 function sendemail(){
	if($('#trackcode').val()==''){
		$('#emailstatus').html('您没有输入跟踪码');
		return false;
	}
	if($('#email').val()==''){
		$('#emailstatus').html('您没有输入电子邮箱');
		return false;
	}
	var strm = $('#email').val();
	var regm = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
	if (!strm.match(regm) && strm!="")
	{
	$('#emailstatus').html('电子邮箱有误');
	return false;
	} 
	$('#emailstatus').html('正在发送跟踪码'+$('#trackcode').val()+'至邮箱'+$('#email').val());
    $.post('/index.php?g=Admin&m=Config&a=sendtrackcode&mail_to='+$('#email').val()+'&body='+$('#trackcode').val(),{}, function(data){
	$('#emailstatus').html(data.info);
	},"json");
}
 </script>